package com.xxzb.pack0822.多线程.多线程的实现.基于Thread类的实现;

public class Test {
    public static void main(String[] args) {
        //创建线程类对象
        ThreadDemo1 t1=new ThreadDemo1();
        t1.setName("子线程1");//设置线程名
//        t1.run(); //run方法会自动执行，无需手动调用
        t1.start();//开启一个子线程

        ThreadDemo1 t2=new ThreadDemo1();
        t2.setName("子线程2");
        t2.start();

        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName()+":ThreadDemo1-->run方法..."+i);
        }
    }
}
